package com.troila.cloud.simplify;

import java.util.HashMap;
import java.util.Map;

import org.springframework.boot.context.properties.ConfigurationProperties;

@ConfigurationProperties(prefix = "attachment")
public class AttachmentSettings {
	private Map<String, String> mime = new HashMap<>();

	private String rootFolder;

	public Map<String, String> getMime() {
		return mime;
	}

	public void setMime(Map<String, String> mime) {
		this.mime = mime;
	}

	public String getRootFolder() {
		return rootFolder;
	}

	public void setRootFolder(String rootFolder) {
		this.rootFolder = rootFolder;
	}
	
	public String getMimeByExtension(String ext, String defaultValue) {
		return mime.containsKey(ext) ? mime.get(ext) : defaultValue;
	}

}
